<?php
include ('MyBaseController.class.php');
/**
 * Home controller class object.
 *
 * @author Lei Lee
 */
class IndexController extends MyBaseController implements IController {
	function initialize() {
		parent::initialize();
		
		header('Content-Type: text/html; charset=UTF-8');
		
		$a = '我是Chinese中国人';
		echo $this->data->truncate($a, 6, '...', 'UTF-8');
		exit(0);
	}
	
	/**
	 * The default entry function.
	 *
	 */
	function index() {
		if ($this->isPost) {
			/*$files = $this->http->upload('file', SITE_ROOT . 'files', true, WebClient::FILE_UPLOAD_MULTIPLE);
			print_r($files); exit(0);*/
		} else {
			$this->cache->setAdapterType(Cache::CACHE_ADAPTER_DB);
			//$this->cache->set('test1', array('Uid'=>1001,'UserName'=>'Lei Lee','Age'=>30));
			$this->cache->delete('test1');
			exit(0);
			//$this->fso->deleteRecursive('E:\Developer\PHP\RadishPHP\demo\tmp');
		//$this->fso->decompress(SITE_ROOT . 'lilei_20110602_01_en.zip', SITE_ROOT, true);
		/*$this->thumb->load(SITE_ROOT . '21039349C5-1.jpg')
						->setWidth(180)
						->create(SITE_ROOT . 'demo.jpg');*/
		/*$this->load('ImgurApi');
			$api = new ImgurApi();
			$api->setHttp($this->http)
				->setKey('iooogle_imgur')
				->setUsername('wuxuexuan@msn.com')
				->setPassword('888888')
				->debug(true);
			$d = $api->send('http://www.china016.com/tu2/Remoteupfile/2011-5/6/2010101407550440.jpg');
			echo '<pre>';
			print_r($d);
			echo '</pre>';
			exit(0);
			
			$this->assign('name', 'Li Lei');
			
			$this->db->useDb('toolkit');
			
			$adapter = PageAdapter::instance();
			$adapter->setPageSize(1)->setOffset('offset')->setCurrentPageIndex(( int ) $this->data->gets('offset', 1))
					->setQueryCount("SELECT COUNT(*) FROM `bto_keywords`")
					->setQueryResult("SELECT * FROM `bto_keywords`");
			$this->db->exec($adapter);
			
			$this->assign('keywords', $adapter->getResult());
			$this->assign('keywords_stat', $adapter->toArray(2));*/
		
		// $this->display('index.tpl.php');
		}
	}
}